package com.proint1.udea.microcurriculo.ctl;

import java.util.List;

import org.apache.log4j.Logger;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.ListModelList;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.ListitemRenderer;

import com.proint1.udea.administracion.Persona;
import com.proint1.udea.microcurriculo.TbMicMicrocurriculo;
import com.proint1.udea.microcurriculo.ngc.MicroCurriculoInt;

public class AprobarMicroCurriculoCtl extends GenericForwardComposer{

	private static Logger logger=Logger.getLogger(AprobarMicroCurriculoCtl.class);
	
	Listbox lbxMicroCurriculo;
	
	private MicroCurriculoInt microCurriculoInt;
	
	public MicroCurriculoInt getMicroCurriculoInt(){
		return microCurriculoInt;
	}
	
	public void setMicroCurriculoInt(MicroCurriculoInt microCurriculoInt){
		this.microCurriculoInt = microCurriculoInt;
	}
	
	public void doAfterCompose(Component comp)throws Exception {
		super.doAfterCompose(comp);
		logger.info("cargando ventana aprobar micro curriculo");
	}
	
	public void onCreate() {
		 definirModelo();
	}

	@SuppressWarnings("unchecked")
	private void definirModelo() {
		List<TbMicMicrocurriculo> listaMicroCurriculo = microCurriculoInt.getMicroCurriculos();
		ListModel<TbMicMicrocurriculo> model = new ListModelList<TbMicMicrocurriculo>(listaMicroCurriculo);
		lbxMicroCurriculo.setModel(model);
		lbxMicroCurriculo.setItemRenderer((ListitemRenderer<TbMicMicrocurriculo>) this);
	}
}
